-
Notifications
You must be signed in to change notification settings - Fork 22.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editorial review: Document popover="hint" #37990
base: main
Are you sure you want to change the base?
Conversation
Preview URLs (16 pages)
Flaws (82)Note! 7 documents with no flaws that don't need to be listed. 🎉 URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
URL:
External URLs (3)URL:
URL: URL: (comment last updated: 2025-02-21 08:49:33) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a few small comments.
files/en-us/web/api/htmlbuttonelement/popovertargetelement/index.md
Outdated
Show resolved
Hide resolved
- `source` {{optional_inline}} | ||
- : An {{domxref("HTMLElement")}} reference; programmatically defines the invoker of the popover associated with the toggle action, that is, the control button or link associated with the popover. | ||
|
||
Associating a popover with a control using the `source` option creates an implicit anchor reference between the two. This makes it very convenient to position popovers relative to their controls using [CSS anchor positioning](/en-US/docs/Web/CSS/CSS_anchor_positioning). Explicit associations do not need to be made using the {{cssxref("anchor-name")}} and {{cssxref("position-anchor")}} properties. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisdavidmills I'm closing all these, but once you've looked at https://github.com/mdn/content/pull/37990/files#r1958808280 you might want to link these to a fixed up section in the Using doc as an intermediate step to getting to the CSS anchor positioning doc.
I.e. "Associating anchor and positioned elements for more details on anchor references." is very general, whereas a specific example for popover hints would be very specific and make things a lot easier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, in my next commit, I have updated all of these bits to briefly explain all of the useful additional effects, and link to the relevant sections in the "Using..." guides. I don't want to repeat the entire explanation on each page.
files/en-us/web/api/htmlinputelement/popovertargetelement/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Hamish Willee <[email protected]>
Co-authored-by: Hamish Willee <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
We should probably add some indication that Interest Invokers can be used in the future to make it trigger via hover. |
I think MDN's policy is to only document things that are available in the platform, not future stuff. But I'm not positive about that. |
That's correct. I'm aware of the interest invokers stuff, but we should save it for a separate PR, when it is implemented. |
@@ -29,9 +29,9 @@ Historically, associating an element with another element and dynamically changi | |||
|
|||
## Associating anchor and positioned elements | |||
|
|||
To associate an element with an anchor, you need to first declare which element is the anchor, and then specify which positioned element(s) to associate with that anchor. This can be done via CSS or via the HTML [`anchor`](/en-US/docs/Web/HTML/Global_attributes/anchor) attribute. | |||
To associate an element with an anchor, you need to first declare which element is the anchor, and then specify which positioned element(s) to associate with that anchor. This creates an anchor reference between the two. This association can be created explicitly via CSS or via the HTML [`anchor`](/en-US/docs/Web/HTML/Global_attributes/anchor) attribute, or in some cases, implicitly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a follow-up: Do we still want to document the anchor attribute? It's not shipped in any browsers and afaik doesn't seem like it will soon because the wider whatwg/csswg aren't convinced by it. This is partly what lead to popovertarget (and commandfor pointing at a popover) creating an implicit anchor relationship.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ended up documenting the anchor
attribute very early on because it was available in Canary and seemed to be a goer. If it looks like it will be killed off, I am happy to remove it. Maybe file an issue about it and wait for more definite action either way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha h! I just commented on this pointing to you @chrisdavidmills . Josh's summation there is correct - the reference is OK because it accurately reflects the situation, but the guide should remove the discussion around use of the anchor until this is either removed or released (not in canary).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in b9c9e03
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-authoritative LGTM
@@ -341,11 +355,31 @@ See our [Popover blur background example](https://mdn.github.io/dom-examples/pop | |||
|
|||
### Implicit popover anchor associations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I still think I'm more likely to find this topic if you call it "Positioning a popover" or "Position a popover relative to its invoker". This heading only means something to me because I already understand it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to push back on this. I don't think changing the heading to something like this would make it particularly easier to find the section, and it would also be kind of inaccurate as to the focus of the section. It's not about positioning the popovers; that's covered in the previous section. This section is specifically about the fact that you don't need to include the anchor position association CSS features the elements in question are popovers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a compromise, I have promoted it to an h2, to make it more visible on the actual page.
@@ -341,11 +355,31 @@ See our [Popover blur background example](https://mdn.github.io/dom-examples/pop | |||
|
|||
### Implicit popover anchor associations | |||
|
|||
Associating a popover with a control using the [`popovertarget`](/en-US/docs/Web/HTML/Element/button#popovertarget) and [`id`](/en-US/docs/Web/HTML/Global_attributes/id) attributes creates an implicit anchor reference between the two, as does programmatically associating a popover action such as {{domxref("HTMLElement.showPopover", "showPopover()")}} with a control using the `source` option. See [Associating anchor and positioned elements](/en-US/docs/Web/CSS/CSS_anchor_positioning/Using#associating_anchor_and_positioned_elements) for more details on anchor references. | |||
Associating a popover with its invoker using the [`popovertarget`](/en-US/docs/Web/HTML/Element/button#popovertarget) attribute or the `source` option of the {{domxref("HTMLElement.showPopover()")}} or {{domxref("HTMLElement.togglePopover()")}} methods creates an implicit anchor reference between the two. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth spelling out that this works for both hints and autos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS I very much like this update. I hope you agree it was worth the effort :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth spelling out that this works for both hints and autos.
It works for manual popovers too. I've clarified this by changing the first line to "Associating any kind of popover..."
PS I very much like this update. I hope you agree it was worth the effort :-)
Indeed, I do ;-)
Description
Chrome 133 supports the
popover
attributehint
value, which creates popovers that do not light-dismissauto
popovers when shown. This is useful for situations where, for example, you have toolbar buttons that can be pressed to show UI popovers, but you also want to reveal tooltips when the buttons are hovered, without dismissing the UI popovers.This PR adds the HTML
popover
attributehint
value to thepopover
HTML global attribute page and theHTMLElement.popover
DOM API equivalent.It also adds a section explaining how to use
popover="hint"
to the Popover API "Using..." guide.As a bonus, I've also added info about the implicit anchor references that are created between popovers (makes CSS anchor positioning easier to use with popovers).
See https://chromestatus.com/feature/5073251081912320 for the data source.
There is no reason why this can't be tech-reviewed now, but we can't merge it until the dom-examples example is reviewed and merged. I am therefore keeping this as a draft for now.
Motivation
Additional details
Related issues and pull requests
popover="hint"
attribute value browser-compat-data#25864Fixes mdn/mdn#598
Fixes #38233